﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BookStore.Bussiness;

namespace BookStore
{
    public partial class Sitemap : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Load_ParentProduct();
                //DataList1.DataSource = Bussiness.productService.Top_productBestsellers();
               // DataList1.DataBind();
            }
        }

        protected void Load_ParentProduct()
        {
            rpListParentProduct.DataSource = catogoryService.Get_catalogALL();
            rpListParentProduct.DataBind();

        }
        protected void rpListParentProduct_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            HiddenField hrId = (HiddenField)e.Item.FindControl("hrID"); //--- day la Id cua loai san pham A---
            Repeater rpChildrent = (Repeater)e.Item.FindControl("rpListChildProduct");
            if ((hrId != null) && (rpChildrent != null))
            {
                rpChildrent.DataSource = catogoryService.Get_catalogID(Convert.ToInt32(hrId.Value.ToString()));
                rpChildrent.DataBind();
            }
        }

        protected void lnbname_Click(object sender, EventArgs e)
        {
            LinkButton lnb = (LinkButton)sender;
            string id = lnb.CommandArgument;
            Response.Redirect("Productdetail.aspx?productId=" + id);

        }
     
    }
}
